package com.ruoyi.jxxwx.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.jxxwx.domain.JxxcoderItems;
import com.ruoyi.jxxwx.service.IJxxcoderItemsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 推荐项目管理Controller
 * 
 * @author 九消Coder QQ932696181
 * @date 2022-06-26
 */
@RestController
@RequestMapping("/jxxwx/items")
public class JxxcoderItemsController extends BaseController
{
    @Autowired
    private IJxxcoderItemsService jxxcoderItemsService;

    /**
     * 查询推荐项目管理列表
     */
    @PreAuthorize("@ss.hasPermi('jxxwx:items:list')")
    @GetMapping("/list")
    public TableDataInfo list(JxxcoderItems jxxcoderItems)
    {
        startPage();
        List<JxxcoderItems> list = jxxcoderItemsService.selectJxxcoderItemsList(jxxcoderItems);
        return getDataTable(list);
    }

    /**
     * 导出推荐项目管理列表
     */
    @PreAuthorize("@ss.hasPermi('jxxwx:items:export')")
    @Log(title = "推荐项目管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JxxcoderItems jxxcoderItems)
    {
        List<JxxcoderItems> list = jxxcoderItemsService.selectJxxcoderItemsList(jxxcoderItems);
        ExcelUtil<JxxcoderItems> util = new ExcelUtil<JxxcoderItems>(JxxcoderItems.class);
        util.exportExcel(response, list, "推荐项目管理数据");
    }

    /**
     * 获取推荐项目管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('jxxwx:items:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(jxxcoderItemsService.selectJxxcoderItemsById(id));
    }

    /**
     * 新增推荐项目管理
     */
    @PreAuthorize("@ss.hasPermi('jxxwx:items:add')")
    @Log(title = "推荐项目管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JxxcoderItems jxxcoderItems)
    {
        return toAjax(jxxcoderItemsService.insertJxxcoderItems(jxxcoderItems));
    }

    /**
     * 修改推荐项目管理
     */
    @PreAuthorize("@ss.hasPermi('jxxwx:items:edit')")
    @Log(title = "推荐项目管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JxxcoderItems jxxcoderItems)
    {
        return toAjax(jxxcoderItemsService.updateJxxcoderItems(jxxcoderItems));
    }

    /**
     * 删除推荐项目管理
     */
    @PreAuthorize("@ss.hasPermi('jxxwx:items:remove')")
    @Log(title = "推荐项目管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(jxxcoderItemsService.deleteJxxcoderItemsByIds(ids));
    }
}
